import itertools

def generate_passwords(custom_word_list):
    """
    生成密码字典。

    参数:
    custom_word_list (list): 用户自定义的单词列表，用于密码的第四部分。
    """
    # 密码的第一部分：DTT的所有大小写组合
    prefix_options = ['DTT', 'DTt', 'DtT', 'dTT', 'Dtt','dTt', 'dtT', 'dtt','Deloitte','deloitte','DELOITTE']
    # 密码的第二部分：0-10之间的五个连续数字
    sequence_numbers = ['2024','20240921','2024/09/20']
    for i in range(7):
        # 生成五个连续数字
        five_consecutive = [str(i + j) for j in range(5)]
        # 将连续数字组合连接成一个字符串
        combination = ''.join(five_consecutive)
        # 将有效的组合添加到列表中
        sequence_numbers.append(combination)
        
    for i in range(6):
    # 生成六个连续数字
        six_consecutive = [str(i + j) for j in range(6)]
        # 将连续数字组合连接成一个字符串
        combination = ''.join(six_consecutive)
        # 将有效的组合添加到列表中
        sequence_numbers.append(combination)

    # 密码的第三部分：下划线
    suffix = ['_','-','@','!','#']
    # 密码的第五部分：A或者B或者a或者b的或者1或者2
    last_part = ['A', 'B','1', '2','a','b']

    with open('passwords.txt', 'w') as file:
        for prefix in prefix_options:
            for number in sequence_numbers:
                for custom_word in custom_word_list:
                    for last in last_part:
                        for part in suffix:
                            password = f"{prefix}{number}{part}{custom_word}{last}"
                            file.write(password + '\n')

# 用户自定义的单词列表，用于密码的第四部分
custom_words = ['case','Case','CASE','session',
                'Step','STEP','Phase','phase','PHASE']

# 调用函数生成密码
generate_passwords(custom_words)
print("密码字典已生成并保存到 passwords.txt 文件中。")